package warmachinesystem.presentation.editpart;

import java.util.List;

import org.eclipse.gef.EditPart;
import org.eclipse.gef.EditPartFactory;

import warmachineroster.Roster;
import warmachinesystem.ArmyList;
import warmachinesystem.BaseUnit;
import warmachinesystem.GameSystem;

public class WarmachineSystemTreeEditPartFactory implements EditPartFactory {

	private Roster roster;

	public WarmachineSystemTreeEditPartFactory(Roster model) {
		this.roster = model;
	}

	@Override
	public EditPart createEditPart(EditPart context, Object model) {
		if (model instanceof GameSystem)
			return new GameSystemTreeEditPart((GameSystem)model, roster);
		if (model instanceof ArmyList){
			return new ArmyListTreeEditPart((ArmyList)model, roster);
		}
		if (model instanceof List<?>){
			return new ListTreeEditPart((List<?>) model, roster);
		}
		if (model instanceof BaseUnit)
			return new BaseUnitTreeEditPart((BaseUnit)model, roster);
		return null;
	}

}

